/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.entidad;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 841756
 */
@Entity
@Table(name = "tblretefuente")
@NamedQueries({
    @NamedQuery(name = "Tblretefuente.findAll", query = "SELECT t FROM Tblretefuente t"),
    @NamedQuery(name = "Tblretefuente.findByCodRetefuente", query = "SELECT t FROM Tblretefuente t WHERE t.codRetefuente = :codRetefuente"),
    @NamedQuery(name = "Tblretefuente.findBySalarioRetefuente", query = "SELECT t FROM Tblretefuente t WHERE t.salarioRetefuente = :salarioRetefuente"),
    @NamedQuery(name = "Tblretefuente.findByARetefuente", query = "SELECT t FROM Tblretefuente t WHERE t.aRetefuente = :aRetefuente"),
    @NamedQuery(name = "Tblretefuente.findByPorcentajeRetefuente", query = "SELECT t FROM Tblretefuente t WHERE t.porcentajeRetefuente = :porcentajeRetefuente"),
    @NamedQuery(name = "Tblretefuente.findByValorRetefuente", query = "SELECT t FROM Tblretefuente t WHERE t.valorRetefuente = :valorRetefuente")})
public class Tblretefuente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "cod_retefuente")
    private String codRetefuente;
    @Basic(optional = false)
    @NotNull
    @Column(name = "salario_retefuente")
    private double salarioRetefuente;
    @Basic(optional = false)
    @NotNull
    @Column(name = "a_retefuente")
    private double aRetefuente;
    @Basic(optional = false)
    @NotNull
    @Column(name = "porcentaje_retefuente")
    private short porcentajeRetefuente;
    @Basic(optional = false)
    @NotNull
    @Column(name = "valor_retefuente")
    private double valorRetefuente;
    @JoinColumn(name = "cod_compania", referencedColumnName = "cod_compania")
    @ManyToOne(optional = false)
    private Tblcompania codCompania;
    @JoinColumn(name = "id_estado", referencedColumnName = "id_estado")
    @ManyToOne(optional = false)
    private TblEstado idEstado;

    public Tblretefuente() {
    }

    public Tblretefuente(String codRetefuente) {
        this.codRetefuente = codRetefuente;
    }

    public Tblretefuente(String codRetefuente, double salarioRetefuente, double aRetefuente, short porcentajeRetefuente, double valorRetefuente) {
        this.codRetefuente = codRetefuente;
        this.salarioRetefuente = salarioRetefuente;
        this.aRetefuente = aRetefuente;
        this.porcentajeRetefuente = porcentajeRetefuente;
        this.valorRetefuente = valorRetefuente;
    }

    public String getCodRetefuente() {
        return codRetefuente;
    }

    public void setCodRetefuente(String codRetefuente) {
        this.codRetefuente = codRetefuente;
    }

    public double getSalarioRetefuente() {
        return salarioRetefuente;
    }

    public void setSalarioRetefuente(double salarioRetefuente) {
        this.salarioRetefuente = salarioRetefuente;
    }

    public double getARetefuente() {
        return aRetefuente;
    }

    public void setARetefuente(double aRetefuente) {
        this.aRetefuente = aRetefuente;
    }

    public short getPorcentajeRetefuente() {
        return porcentajeRetefuente;
    }

    public void setPorcentajeRetefuente(short porcentajeRetefuente) {
        this.porcentajeRetefuente = porcentajeRetefuente;
    }

    public double getValorRetefuente() {
        return valorRetefuente;
    }

    public void setValorRetefuente(double valorRetefuente) {
        this.valorRetefuente = valorRetefuente;
    }

    public Tblcompania getCodCompania() {
        return codCompania;
    }

    public void setCodCompania(Tblcompania codCompania) {
        this.codCompania = codCompania;
    }

    public TblEstado getIdEstado() {
        return idEstado;
    }

    public void setIdEstado(TblEstado idEstado) {
        this.idEstado = idEstado;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codRetefuente != null ? codRetefuente.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tblretefuente)) {
            return false;
        }
        Tblretefuente other = (Tblretefuente) object;
        if ((this.codRetefuente == null && other.codRetefuente != null) || (this.codRetefuente != null && !this.codRetefuente.equals(other.codRetefuente))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + salarioRetefuente + "";
    }
    
}
